/*
 *             _..--""-.                  .-""--.._
 *         _.-'         \ __...----...__ /         '-._
 *       .'      .:::...,'              ',...:::.      '.
 *      (     .'``'''::;                  ;::'''``'.     )
 *       \             '-)              (-'             /
 *        \             /                \             /
 *         \          .'.-.            .-.'.          /
 *          \         | \0|            |0/ |         /
 *          |          \  |   .-==-.   |  /          |
 *           \          `/`;          ;`\`          /
 *            '.._      (_ |  .-==-.  | _)      _..'
 *                `"`"-`/ `/'        '\` \`-"`"`
 *                     / /`;   .==.   ;`\ \
 *               .---./_/   \  .==.  /   \ \
 *              / '.    `-.__)       |    `"
 *             | =(`-.        '==.   ;
 *              \  '. `-.           /
 *               \_:_)   `"--.....-'
 *
 *               file: control_node.h
 *               description: node handle to convert force to gripper movement.
 *               authors: Michiel and Peter
 */
#ifndef CONTROL_NODE_H__
#define CONTROL_NODE_H__

#include <std_msgs/Int32.h>
#include <ros/ros.h>
#include "topics.h"
#include "gripper_defines.h"

/**
 * Class to convert force to current/torque.
 */
class ControlNode
{
protected:
	ros::NodeHandle nh_;
	ros::Subscriber sensor_;
	ros::Publisher motor_pub_;
	int sensor_value;
public:
	ControlNode() : sensor_value(-1)
	{
	}

	~ControlNode()
	{
		nh_.shutdown();
	}


	/**
	 * Init motor, subscribe to force topic.
	 */
	void init();

	/**
	 * Handle callbacks and received information.
	 */
	void spin();

	/**
	 * Get sensor input.
	 * @param	sensor	int32 presenting the sensor value.
	 */
	void sensorCallback(const std_msgs::Int32::ConstPtr &sensor);
};


#endif
